<div id="order">
    <div class="nav">
        <div event-click="{{'$Event.bus.achs.getAllAchs'}}" event-click-change="{{'$Event.changeType'}}" class="nav-li {{TypeNum==3&&'focus'}}" data='3'>所有订单</div>
        <div event-click="{{'$Event.bus.achs.getWeiFukuan'}}" event-click-change="{{'$Event.changeType'}}" class="nav-li {{TypeNum==1&&'focus'}}" data='1'>等待付款</div>
        <div event-click="{{'$Event.bus.achs.getWeiFaHuo'}}" event-click-change="{{'$Event.changeType'}}" class="nav-li {{TypeNum==2&&'focus'}}" data='2'>等待发货</div>
    </div>
    <hr />
    <!-- <div class="titleindex">当前位置：
        <span>{{$Cache.bus.achs.type}}</span>
    </div> -->

    <div class="orders">
        <div class="search">
            <div class="icon-search" style="width:5%;display:inline-block;"></div>
            <div style="width:90%;display:inline-block;">
                <android:input label="搜索订单" description="只需输入订单号的一部分即可搜索，多订单的同时搜索请用“,”分割搜索的关键字" value="{{$Cache.bus.achs.ach_key}}" bind-input="{{'$Cache.bus.achs.ach_key'}}" event-input="{{'$Event.bus.achs.search'}}"></android:input>
            </div>
        </div>
        {{#if $Cache.bus.achs.is_searching&&!$Cache.bus.achs.is_searchend}}
            <h3 style="color:#333">搜索中，请稍后……</h3>
        {{/if}}
        {{#if $Cache.bus.achs.is_searchend&&!bus.achs_detail.length}}
            <h3 style="color:#666">无相关的搜索结果。</h3>
        {{/if}}
        {{#each bus.achs_detail}}
        <ach_bus></ach_bus>
        {{/each}}
    </div>

    {{#if !$Cache.bus.achs.is_searching}}
        <pagination id="turn-page" page-info="$Cache.bus.achs.page_info"></pagination>
    {{/if}}
</div>

<xmp type="tag" name="ach_bus">
    <div class="order-box">
        {{#if __is_cancel}}
        <div class="title" style="background-color:#FF5656;color:#FFF;"><h5>订单已经被取消！</h5>订单号：{{_id}}（用户：{{info.user.info.name}}） </div>
        {{#else}}
            {{#if __is_new}}
            <div class="title" style="background-color:#39762F;color:#FFF;"><h5>新的订单！</h5>订单号：{{_id}}（用户：{{info.user.info.name}}） </div>
            {{#else}}
            <div class="title">订单号：{{_id}}（用户：{{info.user.info.name}}） </div>
            {{/if}}
        {{/if}}
        <div class="detail">
            <div class="goods">
                {{#each info.goods_info}}
                <div class="goods-item">
                    <!-- w:100px h:100px -->
                    <div class="goods-image">
                        <a style="color:#1ba1e2;" href="/goods-details.html?id={{goods._id}}"><img bind-src="{{goods.preview_img_url}}?imageView/1/w/36/h/36"></a>
                    </div>
                    <div class="goods-info-item">
                        <a style="color:#1ba1e2;" href="/goods-details.html?id={{goods._id}}">{{goods.goods_name}}</a>（X {{num}}）</div>
                </div>
                {{/each}}
            </div>
            <div class="price">
                <div class="price-item first">总花费额：{{#Fixed cash}}</div>
                <div class="price-item" title="{{#Time create_time,'L'}}"><b>下单时间：</b>{{#Time create_time,'YYYY-MM-DD HH:mm:ss'}}</div>
            </div>
            {{#> "bus_ach_controller"}}
        </div>

        <div class="addr">
            {{#if info.user_address.name}}
            {{info.user_address.name}},{{#if info.user_address.mobilenumber}} {{info.user_address.mobilenumber}} {{info.user_address.phonenumber&&"/"+info.user_address.phonenumber}} {{#else}} {{info.user_address.phonenumber}} {{/if}}, {{info.user_address.town}},{{info.user_address.county}}，{{info.user_address.detail}}
            {{#else}}
            用户没有填写收货地址
            {{/if}}
        </div>
    </div>
</xmp>

<script type="text/vm">
    function(vm){
        require(['common','jQuery'],function(){
            App.set('TypeNum','1');
            App.set('$Event.changeType',function(){
                App.set('TypeNum',$(this).attr('data'));
            });
        });
    }
</script>
